#!/usr/bin/perl 
#
# Tests for Fangcheng* modules
#
# 2009 Mike Widner <mikewidner@gmail.com>
#
########

use Test::More qw( no_plan );
use Data::Dumper;

BEGIN { use_ok( 'Fangcheng::Matrix' ); 
		use_ok( 'Fangcheng::DB' );
		use_ok( 'Fangcheng::Display' );
		use_ok( 'Fangcheng::CGI' );
		use_ok( 'Fangcheng::Calc::Determinants' );
}

# This test exercises all methods in FangchengMatrix
my $matrix = Fangcheng::Matrix->new(16, 13);
my $matrixCopy = $matrix->copy();
is_deeply($matrix, $matrixCopy,	"Fangcheng::Matrix");

my $db = Fangcheng::DB->new('/home/mwidner/workspace/Fangcheng/Matrices.db');

# If this test passes, pretty much everything's ok in this module
ok($db->list(), 	'Fangcheng::DB');

ok($db->get(1),		'Fangcheng::DB->get(1)');

my @matrices = $db->list();
my $display = Fangcheng::Display->new('Chinese Linear Algebra');

my $calc = Fangcheng::Calc::Determinants->new( );
#$calc->solveByDeterminants( $db->get(1) );
#print $display->convertNumberToRodString(27);
#
#print $display->convertNumberToRodString(-27);
#$matrix->set(1, 1, '3/5');
#print $matrix->get(1,1) . "\n";
#$calc->convertFractionsToIntegers( $matrix );
#print $matrix->get(1,1) . "\n";
$matrix = $db->get(22);
my ($newCalc, $step) = $calc->solveByDeterminants( $matrix );
#print Dumper($matrix);
#print Dumper($calc);
#print Dumper([$newCalc, $step]);
